Multiprotocol label switching (MPLS) is a packet switching technology that allows routing decisions to be based on labels that are appended to the headers of packets. Such a label represents a path in the network and is used to make forwarding decisions until the corresponding packet reaches its destination. Once the packet reaches its destination, the destination device may “pop” (e.g., remove) the corresponding label from the header of the packet and/or apply another label to the packet, to continue routing the packet throughout the network.
Segment routing is a routing technology that may be used in conjunction with MPLS. For example, MPLS labels may be carried in routing protocol messages to enable segment routing in the network. Segment routing defines two forms of segments: adjacency segments and node segments. In general, adjacency segments correspond to a specific adjacency/interface of a given node. In contrast, node segments are more global in nature and represent the shortest path to a node. Notably, the target node of a node segment may be assigned a unique identifier used within the network. Thus, a label switched path (LSP) may be formed by concatenating any number of adjacency and/or prefix segments. When a device along an LSP receives a packet that has a segment as the top label, that label may be reused by any number of intermediary devices to route the packet to the target node associated with the segment. For example, assume that a path exists from nodes A→B→C→D. If node A receives a packet having a top label/node segment associated with node D, it may swap the label with itself and forward the packet to node B. Node B may perform a similar operation and forward the packet on to node C. Node C may then pop the label off of the stack and forward the packet with any remaining labels to node D.